<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>05.事件循环测试</title>
</head>

<body>
 <div class="container">
    <button>点击按钮</button>
 </div>
</body>
<script type="text/javascript">
    // 定时器任务
    console.log("Start");
    setTimeout(() => {
        console.log("In Timeout");
    }, 2000);
    console.log("End");

    // 事件监听器创建宏任务
    const button = document.querySelector("button");

    button.addEventListener("click", () => {
        console.log("Button clicked");
    });

    console.log("Waiting for button click...");
</script>

</html>